<template>
  <el-container>
    <el-header class="container">
      <div class="logo-container">
        <img src="@/assets/logo/logo.png" alt="Logo" class="logo">
        <span class="name">电影制片后台管理系统</span>
      </div>
      <br>
      <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
        <el-menu-item index="1">首页</el-menu-item>
        <el-menu-item index="2">项目展示</el-menu-item>
        <el-menu-item index="3">业务介绍</el-menu-item>
        <el-menu-item index="4" class="menu-item-right">
          <el-button type="primary" @click="handleLogin">登录</el-button>
        </el-menu-item>
        <el-menu-item index="5" class="menu-item-right">
          <el-button type="warning" @click="handleAdmin">后台</el-button>
        </el-menu-item>
      </el-menu>
      <el-footer>
        <router-view>

        </router-view>
      </el-footer>
    </el-header>

  </el-container>
</template>

<script>export default {
  data() {
    return {
      activeIndex: '1'
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      if (key === '1') {
        console.log("456");
        this.$router.push({path: '/front/Home' }); // 使用路由名称跳转
      } else if (key == '2') {
        // 跳转到项目展示页面
        this.$router.push({ path: '/front/Project' });
      } else if (key == '3') {
        // 跳转到业务介绍页面
        this.$router.push({ path: '/front/about' });
      }

    },
    handleLogin() {
      this.$router.push('/login');
    },
    handleAdmin() {
      this.$router.push('/login');
    }
  }
};
</script>

<style scoped>.container {
  background: #3A71A8;
}
.logo-container {
  display: flex;
  align-items: center;
  margin-right: auto;
  margin-top: 10px;
}

.logo {
  width: 40px;
  height: 40px;
  margin-right: 10px;
}

.name {
  color: #fff;
  font-size: 20px;
  font-weight: bold;
}

.el-menu-demo {
  background-color: #fff;
  border-bottom: none;
  font-size: 20px;
  font-weight: bold;
}

.menu-item-right {
  float: right;
  position: relative;
}

.menu-item-right .el-button {
  margin-left: 10px;
}
</style>
